#!/bin/sh
# Bundle launcher: routes the app's stderr/stdout to a log file so issues
# from Finder-launched runs are debuggable without re-running from Terminal.
DIR="$(cd "$(dirname "$0")" && pwd)"
LOG_DIR="$HOME/Library/Logs"
mkdir -p "$LOG_DIR"
LOG="$LOG_DIR/SpaceCadetPinball.log"

# Truncate on each launch so the log is bounded and reflects this session.
: > "$LOG"
echo "[launcher] $(date -u +%Y-%m-%dT%H:%M:%SZ) starting $DIR/SpaceCadetPinball.bin" >> "$LOG"

exec "$DIR/SpaceCadetPinball.bin" "$@" >> "$LOG" 2>&1
